{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b3aa1582-0971-4221-9db7-7e2860b75d7c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "第一次缺勤同学有：李四 王五 姚六 "
     ]
    }
   ],
   "source": [
    "# 从1.csv文件中读取考勤数据\n",
    "with open(\"1.csv\",\"r\",encoding = \"utf-8\") as fo:\n",
    "    foR =fo.readlines() \n",
    "ls = []\n",
    "for line in foR:\n",
    "    line = line.replace(\"\\n\",\"\")\n",
    "    ls.append(line.split(\",\") )\n",
    "# 从name.txt文件中读取所有同学的名单\n",
    "with open(\"Name.txt\",\"r\",encoding = \"utf-8\") as foName:\n",
    "    foNameR = foName.readlines() \n",
    "lsAll = []\n",
    "for line in foNameR:\n",
    "    line = line.replace(\"\\n\",\"\")\n",
    "    lsAll.append(line)\n",
    "#求出第一次缺勤同学的名单\n",
    "    for first in ls:\n",
    "        if first [0] in lsAll:\n",
    "            lsAll.remove(first[0])\n",
    "print(\"第一次缺勤同学有：\",end =\"\")\n",
    "for first in lsAll:\n",
    "    print(first,end=\" \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "af4b23c0-3465-4c8f-8995-cc6ec86dc95e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
